<?php date_default_timezone_set('Australia/Brisbane'); ?>
<script src="<?php echo base_url(); ?>assets/js/assessmentmarker.js"></script>

<div id="assessment_viewer">
	<div id="assessment_mask" style="display: none;">
	
		<div>
			Set mark for <br /> <span id="msknm"></span>
			<em>%</em>
			<form action="<?php echo site_url("/assessment/mark");?>" id="mskfr" method="post">
			<input type="hidden" id="mskhi" name="subid" value="" />
			<input type="hidden" name="itmid" value="<?php echo $item_details['assessment_id']; ?>" />
			<input type="text" id="msktx" name="gradid" value="" />
			</form>
			<b id="mskb2">Set Grade</b>
			<b id="mskb1">Cancel</b>
		</div>
	
	</div>
	<?php
	$nowU = date('U');
	$nowU = $nowU + 604800;
	$nowUa = date('U');
	$format = 'Y-m-d H:i:s';
	$date = DateTime::createFromFormat($format, $item_details['due_date']);
	$dateU = $date->format('U');
	$time = $date->format('G:i');
	$date = $date->format('d/m/Y');
	?>

	<h1><?php echo $item_details['assessment_title']; ?> <span<?php if($nowU >= $dateU && $nowUa < $dateU){echo ' class="r"';}?>> : <?php if($nowUa > $dateU){echo 'Was ';}?>Due <?php echo $date.' at '.$time;?> - Weight: <?php echo $item_details['weight']; ?>% </span></h1>
	<p class="lblabove">Description:</p>
    <p><?php echo $item_details['description']; ?></p>
    <a href="<?php echo site_url("/assessment"); ?>">back to all assessments</a>
    <div id="subtitle">Submissions</div>
    <ul>
    <li class="head"><b>Full Name</b><b>Date Submitted</b><b>Marked?</b></li>
    <?php 
    if($submissions){
    
    foreach($submissions as $key => $item): ?>
		<?php 
		$format = 'Y-m-d H:i:s';
		$dateS = DateTime::createFromFormat($format, $item['timestamp']);
		$dateS = $dateS->format('d/F G:i');
			if($item['marked'] == '1'){
			$marked = 'Yes';
			}else{
			$marked = '<span>No</span>';
			}
		?>
		<li><a href="#<?php echo $item['submission_id'];?>"><b class="sbn"><?php echo $item['user_name'];?></b><b><?php echo $dateS;?></b><b><?php echo $marked;?></b></a></li>
		
	<?php endforeach;
	}else{
	echo '<li class="solo"> There are no submissions for this assessment piece yet.</li>';
	}
	
	?>
	</ul>
</div>
